package com.patternity.apt;

import static java.util.Collections.emptySet;
import static java.util.Collections.unmodifiableCollection;

import java.util.Arrays;
import java.util.Collection;
import java.util.Set;

import com.sun.mirror.apt.AnnotationProcessor;
import com.sun.mirror.apt.AnnotationProcessorEnvironment;
import com.sun.mirror.apt.AnnotationProcessorFactory;
import com.sun.mirror.declaration.AnnotationTypeDeclaration;

/**
 * The standard AnnotationProcessorFactory used by APT
 * 
 * @author cyrillemartraire
 */
public class PatternityAnnotationProcessorFactory implements
		AnnotationProcessorFactory {

	private static final String ANNOTATIONS = "com.martraire.cyrille.example.annotationset1.*";

	// Process any set of annotations
	private static final Collection<String> SUPPORTED_ANNOTATIONS = unmodifiableCollection(Arrays
			.asList(ANNOTATIONS));

	// No supported options
	private static final Collection<String> SUPPORTED_OPTIONS = emptySet();

	@Override
	public Collection<String> supportedAnnotationTypes() {
		return SUPPORTED_ANNOTATIONS;
	}

	@Override
	public Collection<String> supportedOptions() {
		return SUPPORTED_OPTIONS;
	}

	@Override
	public AnnotationProcessor getProcessorFor(
			final Set<AnnotationTypeDeclaration> atds,
			final AnnotationProcessorEnvironment env) {
		System.out.println("***Return AnnotationProcessor****");
		return new AnnotationScanner(env);
	}

}
